package com.dong.es.entity.searchparam.query.match;


import com.dong.es.entity.EsBaseDTO;
import com.dong.es.entity.searchparam.query.EsQueryParam;
import org.apache.commons.lang3.StringUtils;

/**
 * @description: Es 比较相关参数
 * @author: 陈瑞东
 * @create: 2022-06-23 11:40
 */
public abstract class EsMatchQueryParam<T> extends EsQueryParam {

    private static final long serialVersionUID = -274155427465911347L;

    // 字段
    protected String field;
    // 值
    protected T value;

    public EsMatchQueryParam(String field, T value) {
        this.field = field;
        this.value = value;
    }

    @Override
    protected boolean valid(EsBaseDTO esBaseDTO) {
        return StringUtils.isNotBlank(field) && value != null && !"".equals(value);
    }
}
